#include<stdio.h>
int main()
{
	int N,n,k,y;
	scanf("%d",&N);
	while(N--)
	{
		scanf("%d %d",&n,&k);
		y=n*k;
		y=y/10*10;
		printf("%d\n",y);
	}
	return 0;
}